<?php

namespace App\Admin\Forms;


use App\Models\MaintainOrder;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Form;
use Illuminate\Support\Facades\Auth;

class AuditForm extends  Form
{
    /**
     * Handle the form request.
     *
     * @param array $input
     *
     * @return mixed
     */
    public function handle(array $input)
    {
        $maintain = MaintainOrder::query()->where('id',$input['id'])->first();
        $maintain->order_status     = 3;
        $maintain->audit_content    = $input['audit_content'];
        $maintain->audit_user       = Admin::user()->id ?? 1;
        $maintain->audit_time       = date('Y-m-d H:i:s');
        $maintain->save();
        return $this->response()->success('操作成功')->refresh();
    }

    /**
     * Build a form here.
     */
    public function form()
    {
        $this->hidden('id');
        $this->textarea('audit_content','验收内容')->required();

    }

}
